Repository navigation
fix(client): retry HTTP 429 with Retry-After/backoff - #2
Closed
fredericosantos wants to merge 1 commit into
Closed
fredericosantos wants to merge 1 commit into
fredericosantos wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fredericosantos
force-pushed
the
fix/retry-429
branch
from
October 14, 2026 19:12
e931ff0 to
b49d965
Compare
Owner
Author
|
Superseded by aloth#63 (rebuilt on v0.16.2). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every olcli command starts by fetching
/projectto get a CSRF token, so a short burst of commands (for example scriptedcomments addcalls) getsFailed to fetch projects page: 429from Overleaf and exits 1.Change
httpRequestis where every request goes through, so the fix is there: on HTTP 429 it retries up to 5 times, honoringRetry-Afterwhen present and otherwise backing off 1 s, 2 s, 4 s, 8 s, 16 s with ±25% jitter (about 30 s in total). A 429 means the request was rejected, not processed, so retrying is safe for every method. CHANGELOG entry included.This is stacked on the socket-pool PR, so it only contains one commit of its own.
Tests
npm test: 89 passing (one more than the socket-pool branch). The unit test starts a local server that answers 429 twice and then 200 (expects status 200 after 3 calls), and one that always answers 429 (expects status 429 after 6 calls).Tested against real Overleaf rate limiting
I provoked real 429s on my account with
olcli whoami(it fetches/projectlike every command), one trial per row, waiting for the limit to clear between runs:So it helps scripts that run commands one after another, at the cost of waiting. It does not help a large parallel burst even with the longer window and jitter (20 parallel calls: 9 of 20 succeeded either way), because the retries are themselves requests that keep the limit drained. Before the schedule was lengthened, failed calls took about 8.5 s, which matched 3 retries at 1 s, 2 s and 4 s. Overleaf sends no
Retry-Afterheader on these 429s, so the fallback schedule is what applies in practice.What I haven't verified
olcli whoamireportsSession invalidand exits 0 when the cause is a 429. Not touched here.